package com.mixsmart.web.tag.enums;

/**
 * 选择事件触发类型
 * @author lmq <br />
 * 2016年8月2日
 * @version 1.0
 * @since JDK1.6
 */
public enum SelectedEventType {
	
	/**
	 * 1 -- 打开到指定元素上
	 */
	OPEN_TO_TARGET(1, "open_to_target");
	
	private int index;
	private String value;
	
	private SelectedEventType(int index,String value) {
		this.index = index;
		this.value = value;
	}
	
	/**
	 * 获取选择事件触发类型对象
	 * @param index
	 * @return
	 */
	public static SelectedEventType getObj(int index) {
		SelectedEventType eventType = null;
		for (SelectedEventType eventTypeTmp : SelectedEventType.values()) {
			if(eventTypeTmp.getIndex() == index) {
				eventType = eventTypeTmp;
				break;
			}
		}
		return eventType;
	}
	
	/**
	 * 获取选择事件触发类型对象
	 * @param value
	 * @return
	 */
	public static SelectedEventType getObj(String value) {
		SelectedEventType eventType = null;
		for (SelectedEventType eventTypeTmp : SelectedEventType.values()) {
			if(eventTypeTmp.getValue().equals(value)) {
				eventType = eventTypeTmp;
				break;
			}
		}
		return eventType;
	}

	public int getIndex() {
		return index;
	}

	public void setIndex(int index) {
		this.index = index;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}
	
}
